//
//  BodyCell.m
//  SHHCPhone
//
//  Created by gfsh on 14-6-19.
//  Copyright (c) 2014年 sheng long. All rights reserved.
//

#import "BodyCell.h"

@implementation BodyCell
{
    UIImageView *iconIV;
    UILabel *contentLab;
    UIImageView *levelIV;
    UILabel *levelLab;    
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self initContentView];
    }
    return self;
}

- (void)initContentView
{
    iconIV = [[UIImageView alloc]initWithFrame:CGRectMake(0, self.frame.size.height/2-25/2, 25, 25)];
    [self addSubview:iconIV];
    UIImageView *contentIV = [[UIImageView alloc]initWithFrame:CGRectMake(iconIV.frame.origin.x+iconIV.frame.size.width+5, 0, 248, 35)];
    contentIV.image = [UIImage imageNamed:@"体成分-背景"];
    [self addSubview:contentIV];
    contentLab = [[UILabel alloc]initWithFrame:CGRectMake(20, contentIV.frame.origin.y, contentIV.frame.size.width-40, contentIV.frame.size.height)];
    contentLab.textColor = GET_COLOR(@"3e3e3e");
    contentLab.font = [UIFont systemFontOfSize:13];
    [contentIV addSubview:contentLab];
    levelIV = [[UIImageView alloc]initWithFrame:CGRectMake(contentLab.frame.origin.x+contentLab.frame.size.width+2, contentLab.frame.size.height/2-12/2, 12, 12)];
    [self addSubview:levelIV];
    levelLab = [[UILabel alloc]initWithFrame:CGRectMake(levelIV.frame.origin.x+levelIV.frame.size.width+1, contentIV.frame.origin.y, 25, 35)];
    levelLab.textColor = GET_COLOR(@"fcab86");
    levelLab.font = [UIFont systemFontOfSize:12];
    [self addSubview:levelLab];
}

- (void)loadContent
{
    if (self.icon) {
        iconIV.image = self.icon;
    }
    if (self.content) {
        contentLab.text = self.content;
    }
    if (self.levelIcon) {
        levelIV.image = self.levelIcon;
    }
    if (self.levelStr) {
        levelLab.text = self.levelStr;
    }
}

@end
